package io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

public class ByteStreamReadFile {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		File file = new File(ByteStreamWriteFile.filename);
		try {
			InputStream in = new FileInputStream(file);
			byte[] b = new byte[(int)file.length()];
			int num = in.read(b);
			in.close();
			System.out.println("读入长度为："+file.length());
			System.out.println(new String(b));
			
			System.out.println("读入长度为："+num);
			System.out.println(new String(b,0,num));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
